package com.weiaibenpao.demo.chislim.ui.adapter;

import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.weiaibenpao.demo.chislim.R;
import com.weiaibenpao.demo.chislim.bean.Praise;
import com.weiaibenpao.demo.chislim.utils.Utils;


/**
 * Created by Administrator on 2018/1/3.
 */

public class LikerListAdapter extends BaseQuickAdapter<Praise, BaseViewHolder> {


    public LikerListAdapter() {
        super(R.layout.item_praisel_header, null);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, Praise praise) {
        LinearLayout root = baseViewHolder.getView(R.id.root);
        ViewGroup.LayoutParams params = root.getLayoutParams();
        params.width = Utils.getScreenWidth() / 4;
        root.setLayoutParams(params);
        baseViewHolder.setText(R.id.tv_nickname, praise.getUserName());
        Glide
                .with(baseViewHolder.getView(R.id.avatar).getContext())
                .load(praise.getUserImage())
                .into((ImageView) baseViewHolder.getView(R.id.avatar));
    }
}
